//
//  VipCourseClass.m
//  Courses
//
//  Created by YiXuePxh on 15/4/3.
//  Copyright (c) 2015年 boyibang. All rights reserved.
//

#import "VipCourseClass.h"
#import "Request.h"

@implementation VipCourseClass


-(id)initWithJsonDict:(NSDictionary* )jsonDict{
    if (self = [super init]) {
//        _course = [[AdvancedCourse alloc] initWithJsonDict:jsonDict];
        self.courseId = jsonDict[@"courseId"];
        self.courseName = jsonDict[@"courseName"];
        self.classId = jsonDict[@"classId"];
        self.classOpenDate = jsonDict[@"classOpenDate"];
        self.classWeixinName = jsonDict[@"classWeixinName"];
        self.lessonHours = jsonDict[@"lessonHours"];
        self.headTeacher = jsonDict[@"headTeacher"];
        self.teacherId = jsonDict[@"teacherId"];
        self.teacherName = jsonDict[@"teacherName"];
        self.teacherHeadPhotoUrl = jsonDict[@"teacherHeadPhotoUrl"];
        self.orderId = jsonDict[@"orderId"];
        self.className = jsonDict[@"className"];
    }
    return self;
}
+(NSArray* )getCourseArray{
    NSMutableArray* vipCourses = [[NSMutableArray alloc]init];
    Request* request = [Request requestWithName:@"my_vip_courses"];
    Response* response = [request response];
    if (response.result) {
        for (id jsonArray in response.content[@"classes"]) {
            if ([jsonArray isKindOfClass:[NSDictionary class]]) {
                VipCourseClass* course = [[self alloc]initWithJsonDict:jsonArray];
                [vipCourses addObject:course];
            }
        }
    }
    return [vipCourses copy];
}

@end
